home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 1.iso / dist / fw_qt.idb / usr / freeware / include / qwmatrix.h.z / qwmatrix.h
C/C++ Source or Header  |  2001-04-12  |  3KB  |  107 lines

  1. /****************************************************************************
  2. ** $Id: qt/src/kernel/qwmatrix.h   2.3.0   edited 2001-01-26 $
  3. **
  4. ** Definition of QWMatrix class
  5. **
  6. ** Created : 941020
  7. **
  8. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  9. **
  10. ** This file is part of the kernel module of the Qt GUI Toolkit.
  11. **
  12. ** This file may be distributed under the terms of the Q Public License
  13. ** as defined by Trolltech AS of Norway and appearing in the file
  14. ** LICENSE.QPL included in the packaging of this file.
  15. **
  16. ** This file may be distributed and/or modified under the terms of the
  17. ** GNU General Public License version 2 as published by the Free Software
  18. ** Foundation and appearing in the file LICENSE.GPL included in the
  19. ** packaging of this file.
  20. **
  21. ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
  22. ** licenses may use this file in accordance with the Qt Commercial License
  23. ** Agreement provided with the Software.
  24. **
  25. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  26. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  27. **
  28. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  29. **   information about Qt Commercial License Agreements.
  30. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  31. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  32. **
  33. ** Contact info@trolltech.com if any conditions of this licensing are
  34. ** not clear to you.
  35. **
  36. **********************************************************************/
  37.  
  38. #ifndef QWMATRIX_H
  39. #define QWMATRIX_H
  40.  
  41. #ifndef QT_H
  42. #include "qwindowdefs.h"
  43. #include "qpointarray.h"
  44. #include "qrect.h"
  45. #endif // QT_H
  46.  
  47. #ifndef QT_NO_TRANSFORMATIONS
  48.  
  49.  
  50. class Q_EXPORT QWMatrix                    // 2D transform matrix
  51. {
  52. public:
  53.     QWMatrix();
  54.     QWMatrix( double m11, double m12, double m21, double m22,
  55.           double dx, double dy );
  56.  
  57.     void    setMatrix( double m11, double m12, double m21, double m22,
  58.                double dx,  double dy );
  59.  
  60.     double    m11() const { return _m11; }
  61.     double    m12() const { return _m12; }
  62.     double    m21() const { return _m21; }
  63.     double    m22() const { return _m22; }
  64.     double    dx()  const { return _dx; }
  65.     double    dy()  const { return _dy; }
  66.  
  67.     void    map( int x, int y, int *tx, int *ty )          const;
  68.     void    map( double x, double y, double *tx, double *ty ) const;
  69.     QPoint    map( const QPoint & )    const;
  70.     QRect    map( const QRect & )    const;
  71.     QPointArray map( const QPointArray & ) const;
  72.  
  73.     void    reset();
  74.  
  75.     QWMatrix   &translate( double dx, double dy );
  76.     QWMatrix   &scale( double sx, double sy );
  77.     QWMatrix   &shear( double sh, double sv );
  78.     QWMatrix   &rotate( double a );
  79.  
  80.     QWMatrix    invert( bool * = 0 ) const;
  81.  
  82.     bool    operator==( const QWMatrix & ) const;
  83.     bool    operator!=( const QWMatrix & ) const;
  84.     QWMatrix   &operator*=( const QWMatrix & );
  85.  
  86. private:
  87.     QWMatrix   &bmul( const QWMatrix & );
  88.     double    _m11, _m12;
  89.     double    _m21, _m22;
  90.     double    _dx,  _dy;
  91. };
  92.  
  93.  
  94. Q_EXPORT QWMatrix operator*( const QWMatrix &, const QWMatrix & );
  95.  
  96.  
  97. /*****************************************************************************
  98.   QWMatrix stream functions
  99.  *****************************************************************************/
  100.  
  101. Q_EXPORT QDataStream &operator<<( QDataStream &, const QWMatrix & );
  102. Q_EXPORT QDataStream &operator>>( QDataStream &, QWMatrix & );
  103.  
  104. #endif // QT_NO_TRANSFORMATIONS
  105.  
  106. #endif // QWMATRIX_H
  107.